﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;
using EzDesk.Core.Interface;
using EzDesk.Core.Model;
using EzDesk.Core.ServiceImpl;
using EzDesk.Core.ServiceImpl.Repositories;
using EzDesk.Core.ServiceImpl.Repositories.Interface;
using EzDesk.Core.ServiceImpl.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NUnit.Framework;
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;

namespace EzDesk.Core.UnitTest
{
    /// <summary>
    /// Summary description for CoreClientFeedServiceFixture
    /// </summary>
    [TestFixture]
    public class CoreClientFeedServiceFixture
    {
        private Mock<ICoreService> mock_ICoreService;
        private Mock<IOperationProperties> mock_IOperationProperties;
        private Mock<IAppFunctionRepository> mock_IAppFunctionRepository;


        private CoreClientService _coreClientService;


        public CoreClientFeedServiceFixture()
        {
            //
            // TODO: Add constructor logic here
            //
        }


        [SetUp]
        public void SetUp()
        {
            mock_ICoreService = new Mock<ICoreService>();
            mock_IOperationProperties = new Mock<IOperationProperties>();
            mock_IAppFunctionRepository = new Mock<IAppFunctionRepository>();


            this._coreClientService = new CoreClientService(
                mock_ICoreService.Object
                , mock_IOperationProperties.Object
                , mock_IAppFunctionRepository.Object
                );

        }


        #region [ about User Status ]

        [Test]
        public void TestUserStatus()
        {
            var feedId1 = Guid.NewGuid();
            var feedId2 = Guid.NewGuid();

            var userId1 = Guid.NewGuid();
            var userId2 = Guid.NewGuid();

            _coreClientService.SetUserStatus(userId1, feedId1);
            var result1 = _coreClientService.GetUserStatus(userId1);
            Assert.AreEqual(result1, feedId1);

            _coreClientService.SetUserStatus(userId1, feedId2);
            var result2 = _coreClientService.GetUserStatus(userId1);
            Assert.AreEqual(result2, feedId2);

            var result3 = _coreClientService.GetUserStatus(userId2);
            Assert.AreEqual(result3, Guid.Empty);

            _coreClientService.SetUserStatus(userId1, Guid.Empty);
            var result4 = _coreClientService.GetUserStatus(userId1);
            Assert.AreEqual(result4, Guid.Empty);
        }

        #endregion




    }
}
